package jvm.heap.escapeanalysis;

/**
 * @Author: ideaAdmin
 * TODO: 查看是否栈上分配
 *      -Xmx1G -Xms1G -XX:+DoEscapeAnalysis-XX:+PrintGCDetails
 *       -Xmx256m -Xms256m -XX:-DoEscapeAnalysis -XX:+PrintGCDetails
 * Date: 2022/2/22:10:36
 * Description:
 */

public class EscapeAnalysis01 {
    public static void main(String[] args) throws InterruptedException {
        long start = System.currentTimeMillis();
        for (int i = 0; i < 10000000; i++) {
            getUser();
        }
        System.out.println("花费时间:" + (System.currentTimeMillis()-start));

        Thread.sleep(1000000);

    }

    public static void getUser() {
        User user = new User();
    }

    static class User {
    }
}
